package top.ucat.demo.alibaba.cloud.consumer.controller;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import top.ucat.demo.alibaba.cloud.consumer.feign.ConsumerFeignService;
import top.ucat.demo.alibaba.cloud.provider.service.api.ProviderService;

@RestController
public class ConsumerController {

    @Autowired
    private ConsumerFeignService consumerFeignService;

    @Reference
    private ProviderService providerService;

    @GetMapping("/hello")
    public String feignHello() {
        String returnStr = consumerFeignService.hell("consumer");
        return returnStr;
    }


    @GetMapping("/who")
    public String whoCanGiveMeService() {
        String answer = providerService.whoIAm();
        return "I'm consumer,who are you?I'm " + answer;
    }


}
